<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html lang="zh">
<head>
<base href="${APP_PATH}/">
<meta charset="utf-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>教学管理系统</title>
<link rel="icon" href="public/favicon.ico" type="image/ico">
<meta name="keywords" content="LightYear,光年,后台模板,后台管理系统,光年HTML模板">
<meta name="description"
	content="LightYear是一个基于Bootstrap v3.3.7的后台管理系统的HTML模板。">
<meta name="author" content="yinqi">
<jsp:include page="/commons.jsp"></jsp:include>
</head>

<body>
	<div class="lyear-layout-web">
		<div class="lyear-layout-container">
			<!--左侧导航-->
			<%@ include file="/menu.jsp"%>
			<!--End 左侧导航-->

			<!--头部信息-->
			<%@ include file="/head.jsp"%>
			<!--End 头部信息-->

			<!--页面主要内容-->
			<main class="lyear-layout-content">

				<div class="container-fluid">

					<div class="row">
						<div class="col-lg-12">
							<div class="card">
								<div class="card-toolbar clearfix">
									<form class="pull-right search-bar" method="get" 
										role="form">
										<div class="input-group">
											<div class="input-group-btn">
												<input type="hidden" name="search_field" id="search-field"
													value="title">
												<button type="button" class="btn btn-warning" id="btnSelect">
													<i class="glyphicon glyphicon-search"></i> 查询
												</button>

											</div>
											<input type="text" class="form-control" value=""
												name="rnameLike" id="rnameLike" placeholder="请输入名称">

										</div>

									</form>
									<div class="toolbar-btn-action">
										<a class="btn btn-primary m-r-5"  id="btnAdd"><i
											class="mdi mdi-plus"></i>增加</a>   
											
											 <a
											class="btn btn-success m-r-5" id="import"><i
											class="mdi mdi-check" ></i>批量导入学生信息</a>
									</div>
								</div>
								<div class="card-body">
        
									<div class="table-responsive">
									     <form id="delForm">
										<table class="table table-bordered">
											<thead>
												<tr>
													<th><label class="lyear-checkbox checkbox-primary">
															<input type="checkbox" id="check-all"><span></span>
													</label></th>
													<th>序号</th>
													<th>学号</th>
													<th>姓名</th>
													
													<th>邮箱</th>
													<th>电话</th>
													<th>班级</th>
													<th>状态</th>
													<th>学历</th>
													<th>性别</th>
													<th>面试公司</th>
													<th>所在城市</th>
													<th>出生年月</th>
													<th>操作</th>
													

												</tr>
											</thead>
											<tbody id="studentList">



											</tbody>
											</form>
											<tfoot>
												<tr>
													<td colspan="15" align="center">
														<ul class="pagination" id="byPage" >
															
														</ul>
													</td>
												</tr>

											</tfoot>
										</table>
										
									</div>
									<ul class="pagination" id="pageList">



									</ul>

								</div>
							</div>
						</div>

					</div>

				</div>

			</main>
			<!--End 页面主要内容-->
		</div>
	</div>


	<script type="text/javascript">
   $(function(){
       layer.msg("加载中", {time:500, icon:16, shift:5}, function(){
          /*  goPage(1,""); */
       });//layer 
       showByPage(1);
       $("#btnSelect").click(function(){
    	     showByPage(1);
       })
       // 跳转转班页面
     $(document).on("click",".changeClass",function(){
    	         
    	         
    	        var no=$(this).attr("value");
      	       window.location.href="${APP_PATH}/student/changeClass?uid="+no;
      
       })
       function changeClass(no){
    	    alert(123);
       }
   });
          //分页
       function showByPage(pageNum){
	   var rnameLike=$("#rnameLike").val();
	
	        
	               $.ajax({
	            	   url:"${APP_PATH}/student/teacherIndexDo",
	            	   type:"post",
	            	   data:{"pageNum":pageNum ,"rnameLike":rnameLike},
	            	   success:function(data){
	            		   var tbodyContent="";
	            		   
	            		        if(data.msg){
	            		        	$.each(data.studentList,function(index,obj){
	            		        		 tbodyContent+="<tr>";
	            	        			 tbodyContent+="<th><input type='checkbox' name='uid' value='"+obj.uid+"'></th>"
	            	        			 tbodyContent+="<th>"+(index+1)+"</th>";
	            	        			 tbodyContent+="<th>"+obj.sno+"</th>";
	            	        			 tbodyContent+="<th>"+obj.uname+"</th>";
	            	        		
	            	        			 tbodyContent+="<th>"+obj.ueamail+"</th>";
	            	        			 tbodyContent+="<th>"+obj.uphone+"</th>";
	            	        			 tbodyContent+="<th>"+obj.classes.cname+"</th>";
	            	        			 tbodyContent+="<th>"+obj.ustatus+"</th>";
	            	        			 tbodyContent+="<th>"+obj.education+"</th>";
	            	        			 tbodyContent+="<th>"+obj.gender+"</th>";
	            	        			 tbodyContent+="<th>"+obj.company+"</th>";
	            	        			 tbodyContent+="<th>"+obj.city+"</th>";
	            	        			 tbodyContent+="<th>"+obj.birthdate+"</th>";
	            	        			 
	            	        			 if(obj.ustatus!='转班待审核'){ 
	            	        				 tbodyContent+='<th ><a class="changeClass btn btn-danger m-r-5"   value="'+obj.uid+'"><i class="mdi mdi-check" ></i>转班</a></th>';
	            	        			 }else{
	            	        				 tbodyContent+="<th></th>";
	            	        			 }
	            	        			
	            	        			 
	            	        	
	            	                   
	            	        			 tbodyContent+="</tr>";
	            	        			 
	            		        	});
	            		        	$("#studentList").html(tbodyContent);
	            		        	
	            		       
	        	        		 var pageMessage="";
	        	        		 pageMessage+='<li class="'+(data.pageInfo.pageNum==1?"disabled":"")+'"><a onclick="showByPage('+data.pageInfo.perPage+')">上一页</a></li>';
	        		    	     for(var i=1;i<=data.pageInfo.pages;i++){
	        		    	    	 pageMessage+='<li class="'+(data.pageInfo.pageNum==i?"active":"")+'"><a onclick="showByPage('+i+')">'+i+'<span class="sr-only">(current)</span></a></li>';
	        		    	     }
	        		    	     pageMessage+='<li class="'+(data.pageInfo.pageNum==data.pageInfo.pages?"disabled":"")+'"><a onclick="showByPage('+data.pageInfo.nextPage+')">下一页</a></li>';
	        		    	      $("#byPage").html(pageMessage);
	            		        	
	            		        }
	            	   }
	            	   
	               })
	        
	        
	        //跳转添加页面
	         $("#btnAdd").click(function(){
    	      
    	      window.location.href="${APP_PATH}/student/teacherAdd"; 
    	      
       });
	   
	           //删除
	        $("#btnDel").click(function(){
	        	var select=window.confirm("是否确认删除已选择的");
	        	        $.ajax({
	        	        url:"${APP_PATH}/student/teacherDelDo",
	        	        type:"post",
	        	        data:$("#delForm").serialize(),
	        	        success:function(data){
	        	        	 if(data.msg){
	        	        		 layer.msg("删除成功",{time:2000,icon:6,shift:4},function(){
               	    				window.location.href="${APP_PATH}/student/teacherIndex";
               	    			})
	        	        	 }else{
	        	        		 layer.msg("删除失败",{time:2000,icon:5,shift:4},function(){
	               	    			  
	               	    			})
	        	        	 }
	        	        }
	        	     })
	        })
	        
	        $("#import").click(function(){
	        	
	        	window.location.href="${APP_PATH}/student/imports";
	        })
	          
      
	      
   }
     
   
</script>
</body>
</html>
